package com.wrt.wm.entity;

import java.io.Serializable;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

/**
 * 返给前端结果的实体类
 * 
 * @author 文瑞涛
 */
@Getter
@Setter
@AllArgsConstructor
public class AjaxResult implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 9042077055448023061L;

	/**
	 * 结果码
	 * 0-成功；1-失败
	 */
	private Integer code;
	/**
	 * 消息
	 */
	private String msg;
	/**
	 * 需要传递给前端的对象
	 */
	private Object data;

	public static AjaxResult success(String msg, Object data) {
		return new AjaxResult(Integer.valueOf(0), msg, data);
	}

	public static AjaxResult fail(String msg) {
		return new AjaxResult(Integer.valueOf(1), msg, null);
	}
}
